package org.come.Jpanel;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.ImageObserver;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import javax.swing.*;

import com.tool.btn.*;
import com.tool.pet.PetProperty;
import io.netty.util.internal.StringUtil;
import org.come.Frame.TestSetupJframe;
import org.come.action.petpaixu.MyRenderer;
import org.come.bean.ConfigureBean;
import org.come.entity.RoleSummoning;
import org.come.model.Configure;
import org.come.mouslisten.PetJlistChoseMouslisten1;
import org.come.mouslisten.PointChangeMouslisten;
import org.come.mouslisten.WLLMouslisten;
import org.come.until.*;
import org.soaring.btn.CharacterBtn;
import org.come.bean.Skill;

import com.tool.image.ImageMixDeal;
import com.tool.role.RoleData;
import com.tool.tcp.NewPart;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;




/**
 * @author 郑吉利
 * @date : 2017年11月22日 下午10:26:40
 */

public class TestPetJpanel1 extends JPanel implements MouseListener {

    private ImageIcon icon = new ImageIcon("inkImg/newbackground/B294.png");
    private static TestPetJpanel1 testPetJpanel1;
    // 召唤兽列表
    private static JList<String> listpet;
    // 列表中的对象
    private static DefaultListModel<String> listModel;// 放置召唤兽的对象
    // 列表中对象的名字颜色
    private Color fontcolor;
    private Color niubikelas;
    // 滚动条
    private JScrollPane jScrollPane;
    private int level;
    // 召唤兽名称
    private static JTextField labname;
    private static JLabel lablevel,// 放置召唤兽等级
            labloyalty// 放置召唤兽忠诚
            , labclose // 放置召唤兽亲密
            , labHP, labMP, labAP, labSP, labCP, labEXP// HP、MP、AP、SP、禅定、 EXP
            , labrootbone// 根骨输入框
            , labintelligence// 灵性输入框
            , labpower// 力量输入框
            , labspeed// 敏捷输入框
            , labconcentrate // 定力输入框
            , labpointnumber;// 可分配点数输入框
    private static JLabel changeImg;
    private PetPanelBtn1 btnpetnamech, // 更改召唤兽名字按钮
            lingxi, // 灵犀按钮
            btnwar, // 参战按钮
            btnpetgk,//召唤兽跟随
            btnpetyc //召唤兽跟随
            // , btnrest// 召唤兽休息按钮
            , btnaddlittle// 召唤兽加点按钮
            , btndomesticated// 召唤兽驯养按钮
            , btnpetkills// 召唤兽技能按钮
            , btnpetarticles// 召唤兽物品按钮
            , btnsmeltmonster// 炼妖按钮
            , btnrelease// 放生按钮
            , btnRolequality// 抗性按钮
            , handbook//图鉴
            , btnsummon;// 召唤按钮
    private GoodAndPetLockBtn btnlock, // 召唤兽加锁按钮
            btnunlock;// 召唤兽解锁按钮

    //召唤兽技能显示
    private JLabel[] labSkillImg;
    private JLabel[] lskilldi;
    private ImageIcon kaiqi;
    private ImageIcon fengyin;
    private int time;
    private String type;
    //召唤兽技能显示

    private static JLabel petsum;// 召唤兽数量

    private static NeidanBtn[] labNedan = new NeidanBtn[100];// 放置内丹的四个小框框
    private final CharacterBtn[] dians = new CharacterBtn[10];
    //public static JLabel labgundong = new JLabel(new ImageIcon("inkImg/hongmu/soaring/滚动条w18,h100px.png"));
    final ImageIcon imageIcon = new ImageIcon("img/123_副本.png");
    /**
     * 字段名:warNum 参战位数<br>
     */
    private static int warNum = -1;

    public TestPetJpanel1() throws Exception {
        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));

        this.add(this.getChangeImg());
        testPetJpanel1 = this;
        this.setPreferredSize(new Dimension(469, 480));
        this.setLayout(null);
        this.setBackground(UIUtils.Color_BACK);
        this.setLayout(null);
        // 关闭按钮事件
        FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 666);
        offBtn.setBounds(469 - 37, 10, 25, 25);
        this.add(offBtn);
        listModel = new DefaultListModel<String>();
        // 召唤兽列表
        listpet = new JList<String>() {
            {
                setOpaque(false);
            } // instance initializer
        };
        listpet.setSelectionBackground(new Color(33, 42, 52));
        fontcolor = Color.white;// 203,181,91
        listpet.setSelectionForeground(fontcolor);
        listpet.setForeground(fontcolor);
        listpet.setFont(new Font("楷体", 1, 16));
        listpet.setBackground(UIUtils.Color_BACK); // 设置列表框为透明背景
        listpet.setModel(listModel);
        listpet.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        DefaultListCellRenderer renderer = new DefaultListCellRenderer() {
            Color color = new Color(203, 181, 91);

            @Override
            public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
                                                          boolean cellHasFocus) {
                super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                if (warNum == index) {
                    this.setForeground(color);
                } else {
                    this.setForeground(Color.white);
                }
                return this;
            }
        };

//        listpet.setCellRenderer(renderer);
        listpet.setCellRenderer(new MyRenderer());
        listpet.addMouseListener(new PetJlistChoseMouslisten1(listpet, this));
        listpet.addMouseMotionListener(new PetJlistChoseMouslisten1(listpet, this));
        // 召唤兽列表滚动条
        jScrollPane = new JScrollPane(listpet);
        jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane.getVerticalScrollBar().setUI(new SrcollPanelUI());
        jScrollPane.getViewport().setOpaque(false);
        jScrollPane.setOpaque(false);
        jScrollPane.setBounds(50, 81, 189, 215);
        jScrollPane.setBorder(BorderFactory.createEmptyBorder());
        jScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        this.add(jScrollPane);

        labNedan = new NeidanBtn[Integer.parseInt(configure.getNdslsx())];

        for (int i = 0; i < Integer.parseInt(configure.getNdslsx()); i++) {
            labNedan[i] = new NeidanBtn("skin/8100226/button/B161.png", 1, i);
            labNedan[i].setBounds(240, 60 + i * 18, 18, 18);
            this.add(labNedan[i]);
        }

        for (int i = 0; i < dians.length; i++) {
            if (i % 2 == 0) {
                dians[i] = new CharacterBtn("skin/8100226/button/12.png", 1, 10 + i);
            } else {
                dians[i] = new CharacterBtn("skin/8100226/button/11.png", 1, 10 + i);
            }
            dians[i].setBounds(329 + i % 2 * 14, 300 + i / 2 * 25, 0, 0);
            dians[i].addMouseListener(new PointChangeMouslisten(i + 10));
            this.add(dians[i]);
        }

        Font font = new Font("微软雅黑", 1, 12);
        // 名称
        labname = new JTextField();
        labname.setBounds(95, 334, 130, 15);
        labname.setForeground(Color.white);
        labname.setOpaque(false);
        labname.setBorder(BorderFactory.createEmptyBorder());
        labname.setFont(font);
        labname.setCaretColor(Color.white);
        this.add(labname);

        // 等级
        lablevel = new JLabel();
        lablevel.setBounds(95, 334 + 24, 130, 15);
        lablevel.setForeground(Color.WHITE);
        lablevel.setFont(font);
        this.add(lablevel);

        // 忠诚
        labloyalty = new JLabel();
        labloyalty.setBounds(95, 334 + 24 * 2, 130, 15);
        labloyalty.setForeground(Color.WHITE);
        labloyalty.setFont(font);
        this.add(labloyalty);

        // 亲密
        labclose = new JLabel();
        labclose.setBounds(95, 334 + 24 * 3, 130, 15);
        labclose.setForeground(Color.WHITE);
        labclose.setFont(font);
        this.add(labclose);

        // HP
        labHP = new JLabel();
        labHP.setBounds(308, 310, 130, 15);
        labHP.setForeground(Color.WHITE);
        labHP.setFont(font);
        this.add(labHP);

        // MP
        labMP = new JLabel();
        labMP.setBounds(308, 310 + 24, 130, 15);
        labMP.setForeground(Color.WHITE);
        labMP.setFont(font);
        this.add(labMP);

        // AP
        labAP = new JLabel();
        labAP.setBounds(308, 310 + 24 * 2, 130, 15);
        labAP.setForeground(Color.WHITE);
        labAP.setFont(font);
        this.add(labAP);

        // SP
        labSP = new JLabel();
        labSP.setBounds(308, 310 + 24 * 3, 130, 15);
        labSP.setForeground(Color.WHITE);
        labSP.setFont(font);
        this.add(labSP);


        // 禅定
        labCP = new JLabel("135");
        labCP.setBounds(308, 310 + 24 * 4, 130, 15);
        labCP.setForeground(Color.WHITE);
        labCP.setFont(font);
        this.add(labCP);

        // EXP
        labEXP = new JLabel();
        labEXP.setBounds(81, 423, 0, 0);
        labEXP.setForeground(Color.WHITE);
        labEXP.setFont(font);
        this.add(labEXP);

        // 根骨
        labrootbone = new JLabel();
        labrootbone.setBounds(260, 300, 0, 0);
        labrootbone.setForeground(Color.WHITE);
        labrootbone.setFont(font);
        this.add(labrootbone);

        // 灵性
        labintelligence = new JLabel();
        labintelligence.setBounds(260, 325, 0, 0);
        labintelligence.setForeground(Color.WHITE);
        labintelligence.setFont(font);
        this.add(labintelligence);

        // 力量
        labpower = new JLabel();
        labpower.setBounds(260, 350, 0, 0);
        labpower.setForeground(Color.WHITE);
        labpower.setFont(font);
        this.add(labpower);

        // 敏捷
        labspeed = new JLabel();
        labspeed.setBounds(260, 375, 0, 0);
        labspeed.setForeground(Color.WHITE);
        labspeed.setFont(font);
        this.add(labspeed);

        // 定力
        labconcentrate = new JLabel("0");
        labconcentrate.setBounds(260, 400, 0, 0);
        labconcentrate.setForeground(Color.WHITE);
        labconcentrate.setFont(font);
        this.add(labconcentrate);

        // 可分配点数
        labpointnumber = new JLabel();
        labpointnumber.setBounds(310, 273, 0, 0);
        labpointnumber.setForeground(Color.WHITE);
        labpointnumber.setFont(font);
        this.add(labpointnumber);

        //宠物跟随观看
        btnpetgk = new PetPanelBtn1("skin/8100226/button/19.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "观", 20,
                this);
        btnpetgk.setBounds(220, 20, 0, 0);
        this.add(btnpetgk);
        //宠物观看隐藏
        btnpetyc = new PetPanelBtn1("skin/8100226/button/19.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "隐", 21,
                this);
        btnpetyc.setBounds(245, 20, 0, 0);
        this.add(btnpetyc);

        // 修改名称按钮
        btnpetnamech = new PetPanelBtn1("skin/8100226/button/19.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "改", 1,
                this);
        btnpetnamech.setBounds(183, 196, 0, 0);
        this.add(btnpetnamech);
        // 驯养按钮
        btndomesticated = new PetPanelBtn1("skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "驯养", 5,
                this);
        btndomesticated.setBounds(170, 247, 0, 0);
        this.add(btndomesticated);
        // 放生宠物按钮
        btnrelease = new PetPanelBtn1("skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "放生", 9, this);
        btnrelease.setBounds(170, 221, 0, 0);
        this.add(btnrelease);

        // 灵犀按钮
//        lingxi = new PetPanelBtn1("skin/8100226/button/lx148.png", 1, UIUtils.COLOR_BLACK, UIUtils.TEXT_HY88, "", 601, this);
//        lingxi.setBounds(416, 59, 40, 40);
////    		this.add(lingxi);
//        lingxi.setVisible(false);

        // 参战按钮
        btnwar = new PetPanelBtn1( "skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "参战", 2, this);
        btnwar.setBounds(290, 241, 0, 0);
        this.add(btnwar);

        // 加点按钮
        btnaddlittle = new PetPanelBtn1("skin/8100226/button/49.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "确认加点", 4,
                this);
        btnaddlittle.setBounds(255, 398, 0, 0);
        this.add(btnaddlittle);

        // 宠物物品按钮
        btnpetarticles = new PetPanelBtn1("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "物品",
                7, this);
        btnpetarticles.setBounds(18 + 11, 460 - 8, 0, 0);
        this.add(btnpetarticles);
        // 宠物炼妖按钮
        btnsmeltmonster = new PetPanelBtn1( "skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "炼妖",
                8, this);
        btnsmeltmonster.setBounds(82 + 15, 460 - 8, 0, 0);
        this.add(btnsmeltmonster);

        // 抗性按钮
        btnRolequality = new PetPanelBtn1( "skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "抗性",
                10, this);
        btnRolequality.setBounds(65, 435, 59, 24);
        this.add(btnRolequality);

        // 召唤按钮
        btnsummon = new PetPanelBtn1("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "召唤", 11,
                this);
        btnsummon.setBounds(65 + 150, 435, 59, 24);
        this.add(btnsummon);

        // 宠物技能按钮
        btnpetkills = new PetPanelBtn1("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "技能", 6,
                this);
        btnpetkills.setBounds(65 + 150 * 2, 435, 59, 24);
        this.add(btnpetkills);

        // 召唤兽加锁按钮
        btnlock = new GoodAndPetLockBtn("skin/8100226/newbutton/K156.png", 1, 3);
        btnlock.setBounds(275 + 45, 20, 0, 0);
        this.add(btnlock);

        // 召唤兽加锁按钮
        btnunlock = new GoodAndPetLockBtn("skin/8100226/newbutton/K157.png", 1, 4);
        btnunlock.setBounds(297 + 45, 20, 0, 0);
        this.add(btnunlock);


        //召唤兽技能显示
        this.labSkillImg = new JLabel[9];
        this.lskilldi = new JLabel[9];
        int j = 0;
        while (j < this.labSkillImg.length) {
            (this.labSkillImg[j] = new JLabel()).setOpaque(false);
            this.labSkillImg[j].setBounds(381, 78 + j * 26, 21, 21);
            this.add((Component) this.labSkillImg[j]);
            ++j;
        }
        j = 0;
        while (j < this.lskilldi.length) {
            (this.lskilldi[j] = new JLabel()).setIcon(new ImageIcon("inkImg/old/7/ss464.png"));
            this.lskilldi[j].setOpaque(false);
            this.lskilldi[j].setBounds(378, 76 + j * 26, 27, 25);
            this.add((Component) this.lskilldi[j]);
            ++j;
        }
        //召唤兽技能显示


        // 召唤兽数量
//        (TestPetJpanel.petsum = new JLabel()).setForeground(new Color(187, 165, 75));
        (TestPetJpanel1.petsum = new JLabel()).setForeground(Color.WHITE);
        TestPetJpanel1.petsum.setFont(new Font("仿宋", 1, 15));
        this.add((Component) TestPetJpanel1.petsum);


    }

    /**
     * 0-4 获取根骨灵性力量敏捷可分配点
     */
    public int getdian(int type) {
        try {
            if (type == 0) {
                type = Integer.parseInt(labrootbone.getText());
            } else if (type == 1) {
                type = Integer.parseInt(labintelligence.getText());
            } else if (type == 2) {
                type = Integer.parseInt(labpower.getText());
            } else if (type == 3) {
                type = Integer.parseInt(labspeed.getText());
            } else if (type == 4) {
                type = Integer.parseInt(labconcentrate.getText());
            } else if (type == 5) {
                type = Integer.parseInt(labpointnumber.getText());
            }
        } catch (Exception e) {
            // TODO: handle exception
            type = 0;
        }
        return type;
    }

    /**
     * 0-4 点数变化根骨灵性力量敏捷可分配点
     */
    public void adddian(int type, int point) {
        try {
            if (type == 0) {
                type = Integer.parseInt(labrootbone.getText());
                labrootbone.setText(type + point + "");
            } else if (type == 1) {
                type = Integer.parseInt(labintelligence.getText());
                labintelligence.setText(type + point + "");
            } else if (type == 2) {
                type = Integer.parseInt(labpower.getText());
                labpower.setText(type + point + "");
            } else if (type == 3) {
                type = Integer.parseInt(labspeed.getText());
                labspeed.setText(type + point + "");
            } else if (type == 4) {
                type = Integer.parseInt(labconcentrate.getText());
                labconcentrate.setText(type + point + "");
            }
            type = Integer.parseInt(labpointnumber.getText());
            labpointnumber.setText(type - point + "");
        } catch (Exception e) {
            // TODO: handle exception
        }
    }


    public static void showStar() {
        int i;
        if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null) {//空
            listModel.removeAllElements();//去除
            for (i = 0; i < UserMessUntil.getPetListTable().size(); ++i) {// 召唤兽信息list

                // 放置召唤兽的对象(召唤兽+召唤兽名字)
                listModel.add(i, UserMessUntil.getPetListTable().get(i).getSummoningname());
                if (RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(UserMessUntil.getPetListTable().get(i).getSid()) == 0) {//点击参战后
                    listModel.set(i, "【战】" + UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                }
                if (UserMessUntil.getPetListTable().get(i).isShow()) {//点击观看后
                    listModel.set(i, "(观)" + UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                } else if (!UserMessUntil.getPetListTable().get(i).isShow() && RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(UserMessUntil.getPetListTable().get(i).getSid()) != 0) {
                    listModel.set(i, UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                }
            }
        } else {
            listModel.removeAllElements();
            for (i = 0; i < UserMessUntil.getPetListTable().size(); ++i) {
                listModel.add(i, UserMessUntil.getPetListTable().get(i).getSummoningname());
            }
        }
    }

    public static void showListModel(List<RoleSummoning> pets, BigDecimal petid) {
        listModel.removeAllElements();
        warNum = -1;

        for (int i = 0, length = pets.size(); i < length; i++) {
            RoleSummoning pet = pets.get(i);
            if (petid != null && petid.compareTo(pet.getSid()) == 0) {
                warNum = i;
                listModel.addElement("【战】" + pet.getSummoningname());
            } else {
                listModel.addElement(pet.getSummoningname());
            }
            if (UserMessUntil.getPetListTable().get(i).isShow()) {//点击观看后
                listModel.set(i, "(观)" + UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
            } else if (!UserMessUntil.getPetListTable().get(i).isShow()) {
                if (UserMessUntil.getPetListTable().get(i).getSid() != null) {
                    if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null && RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(UserMessUntil.getPetListTable().get(i).getSid()) != 0) {
                        listModel.set(i, UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                    }
                }
            }
        }
    }

//    public static void showStar() {
//        warNum = listpet.getSelectedIndex();
//        // 判断如果有参战召唤兽,这只召唤兽的前面就加个(*)
//        if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null && warNum != -1) {
//            String name = listModel.getElementAt(warNum);
//            listModel.remove(warNum);
//            listModel.add(warNum, "( * )"+name);
//            listpet.setSelectedIndex(warNum);
//
//            for (int i = 0,length =listModel.size(); i < length; i++) {
//                name = listModel.getElementAt(i);
//                if (warNum != i && name.startsWith("* ")) {
//                    listModel.remove(i);
//                    listModel.add(i,name.substring(2));
//                }
//            }
//        }
//    }

    /**
     * 飞升前和飞升后的界面切换
     *
     * @param lvltrue <=3没有飞升 >3飞升
     */
    public void changeSoaringPanel(int lvltrue) {
        level = lvltrue;
        if (lvltrue <= 3) {// 没有飞升
            // 隐藏飞升后才有的功能
            dians[8].setVisible(false);
            dians[9].setVisible(false);
            labconcentrate.setVisible(false);
            labCP.setVisible(false);
            labEXP.setBounds(81, 399, 0, 0);
            btnaddlittle.setBounds(255, 398, 0, 0);
            icon = CutButtonImage.getImage( "inkImg/newbackground/B294.png", -1, -1);
        } else {// 飞升
            // 展示飞升才有的功能
            dians[8].setVisible(true);
            dians[9].setVisible(true);
            labconcentrate.setVisible(true);
            labCP.setVisible(true);
//            lingxi.setVisible(true);
//            this.add(lingxi);
            labEXP.setBounds(81, 425, 0, 0);
            btnaddlittle.setBounds(255, 425, 0, 0);
            icon = CutButtonImage.getImage("inkImg/newbackground/B294.png", -1, -1);
        }

    }

    public static NewPart part;


    private ImageIcon petskillIcon(final String skillid) {
        return CutButtonImage.getImage("inkImg/old/skill/wxs_" + skillid + ".png", 29, 29);
    }




    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        // 召唤兽数量
        final int sun = UserMessUntil.getPetListTable().size();
//        TestPetJpanel1.petsum.setText("(" + sun + "/" + RoleData.getRoleData().getPackRecord().getPettNum() + ")");
        TestPetJpanel1.petsum.setText("召唤兽" + "(" + sun + "/" + 30 + ")");

        Graphics2D graphics2d = (Graphics2D) g;
//        if (icon == null)


        // 召唤兽数量
        TestPetJpanel1.petsum.setBounds(88, 63, 135, 15);
        // 道具栏
        graphics2d.drawImage(this.icon.getImage(), 0, 0, 469, 480, this);

        RoleSummoning pet = UserMessUntil.getChosePetMes();
        if (pet != null) {
            if (part == null) {
                part = pet.getPart();
            }
            if (part != null) {
                part.draw(graphics2d, 350, 250, 0, ImageMixDeal.userimg.getTime());
            }
            // 如果这只召唤兽有加锁
            if (pet.getPetlock() == 1) {
                GoodsListFromServerUntil.drawPetLock(graphics2d, pet);
            }
        }
        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));
        if (listModel.size() <= 0) {
            for (int i = 0; i < Integer.parseInt(configure.getNdslsx()); i++) {
                labNedan[i].setIcon(null);
            }
        }
        //消除文字锯齿
        graphics2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        //消除画图锯齿
        graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        //召唤兽技能显示
        final int[] pets = PetProperty.getPetHMASp(pet);
        if (pet != null) {
            int i = 0;
            while (i < this.labSkillImg.length) {
                this.labSkillImg[i].setBounds(426, 64 + i * 26, 22, 23);
                ++i;
            }
            i = 0;
            while (i < this.lskilldi.length) {
                this.lskilldi[i].setBounds(423, 62 + i * 26, 28, 27);
                this.lskilldi[i].setIcon(new ImageIcon("skin/8100226/button/SS510.png"));
                ++i;
            }

            i = 0;
            while (i < pets.length) {
                pets[i] = 0;
                ++i;
            }
            int openSeal = pet.getOpenSeal().intValue();
            if (openSeal > 9) {
                openSeal = 9;
            }
            int j = openSeal;
            while (j < 9) {
                this.labSkillImg[j].setIcon((Icon) this.fengyin);
                this.labSkillImg[j].setVisible(false);
                this.lskilldi[j].setVisible(false);
                ++j;
            }
            if (!StringUtil.isNullOrEmpty(this.type) && (this.type.equals("0") || this.type.equals("1") || this.type.equals("5"))) {
                this.labSkillImg[8].setVisible(false);
            }
            String[] skills = null;
            if (pet.getPetSkills() != null && !pet.getPetSkills().equals("")) {
                skills = pet.getPetSkills().split("\\|");
            }
            int k = 0;
            while (k < openSeal) {
                if ((skills != null && k < skills.length) || (k == 8 && pet.getBeastSkills() != null && !pet.getBeastSkills().equals(""))) {
                    final Skill skill = UserMessUntil.getSkillId((k == 8) ? pet.getBeastSkills() : skills[k]);
                    if (skill != null) {
                        this.labSkillImg[k].setIcon((Icon) this.petskillIcon(skill.getSkillid()));
                        this.lskilldi[k].setVisible(true);
                    }
                } else {
                    this.labSkillImg[k].setIcon((Icon) this.kaiqi);
                    this.labSkillImg[k].setVisible(false);
                    this.lskilldi[k].setVisible(false);
                }
                this.labSkillImg[k].setVisible(true);
                ++k;
            }
        }
        return;

        //召唤兽技能显示

    }


    public static int idx = -1;

    // 初始列表
    public void initS(List<String> list) {
        listModel.clear();
        for (int i = 0; i < list.size(); i++) {
            listModel.addElement(list.get(i));
        }
    }


    @Override
    public void mouseClicked(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mousePressed(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseReleased(MouseEvent e) {

        FormsManagement.HideForm(666);
        // ChosePetMouslisten.setWhether(true);

    }

    @Override
    public void mouseEntered(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseExited(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    public static JList<String> getListpet() {
        return listpet;
    }

    public static void setListpet(JList<String> listpet) {
        TestPetJpanel1.listpet = listpet;
    }

//    public static DefaultListModel<String> getListModel() {
//        return listModel;
//    }
//
//    public static void setListModel(DefaultListModel<String> listModel) {
//        TestPetJpanel1.listModel = listModel;
//    }

    public Color getFontcolor() {
        return fontcolor;
    }

    public void setFontcolor(Color fontcolor) {
        this.fontcolor = fontcolor;
    }

    public JScrollPane getjScrollPane() {
        return jScrollPane;
    }

    public void setjScrollPane(JScrollPane jScrollPane) {
        this.jScrollPane = jScrollPane;
    }

    public static JTextField getLabname() {
        return labname;
    }

    public static void setLabname(JTextField labname) {
        TestPetJpanel1.labname = labname;
    }

    public static JLabel getLablevel() {
        return lablevel;
    }

    public static void setLablevel(JLabel lablevel) {
        TestPetJpanel1.lablevel = lablevel;
    }

    public static JLabel getLabloyalty() {
        return labloyalty;
    }

    public static void setLabloyalty(JLabel labloyalty) {
        TestPetJpanel1.labloyalty = labloyalty;
    }

    public static JLabel getLabHP() {
        return labHP;
    }

    public static void setLabHP(JLabel labHP) {
        TestPetJpanel1.labHP = labHP;
    }

    public static JLabel getLabMP() {
        return labMP;
    }

    public static void setLabMP(JLabel labMP) {
        TestPetJpanel1.labMP = labMP;
    }

    public static JLabel getLabAP() {
        return labAP;
    }

    public static void setLabAP(JLabel labAP) {
        TestPetJpanel1.labAP = labAP;
    }

    public static JLabel getLabSP() {
        return labSP;
    }

    public static void setLabSP(JLabel labSP) {
        TestPetJpanel1.labSP = labSP;
    }

    public static JLabel getLabEXP() {
        return labEXP;
    }

    public static void setLabEXP(JLabel labEXP) {
        TestPetJpanel1.labEXP = labEXP;
    }

    public static JLabel getLabrootbone() {
        return labrootbone;
    }

    public static void setLabrootbone(JLabel labrootbone) {
        TestPetJpanel1.labrootbone = labrootbone;
    }

    public static JLabel getLabintelligence() {
        return labintelligence;
    }

    public static void setLabintelligence(JLabel labintelligence) {
        TestPetJpanel1.labintelligence = labintelligence;
    }

    public static JLabel getLabpower() {
        return labpower;
    }

    public static void setLabpower(JLabel labpower) {
        TestPetJpanel1.labpower = labpower;
    }

    public static JLabel getLabspeed() {
        return labspeed;
    }

    public static void setLabspeed(JLabel labspeed) {
        TestPetJpanel1.labspeed = labspeed;
    }

    public static JLabel getLabpointnumber() {
        return labpointnumber;
    }

    public static void setLabpointnumber(JLabel labpointnumber) {
        TestPetJpanel1.labpointnumber = labpointnumber;
    }

    public PetPanelBtn1 getBtnpetnamech() {
        return btnpetnamech;
    }

    public void setBtnpetnamech(PetPanelBtn1 btnpetnamech) {
        this.btnpetnamech = btnpetnamech;
    }

    public PetPanelBtn1 getBtnaddlittle() {
        return btnaddlittle;
    }

    public void setBtnaddlittle(PetPanelBtn1 btnaddlittle) {
        this.btnaddlittle = btnaddlittle;
    }

    public PetPanelBtn1 getBtndomesticated() {
        return btndomesticated;
    }

    public void setBtndomesticated(PetPanelBtn1 btndomesticated) {
        this.btndomesticated = btndomesticated;
    }

    public PetPanelBtn1 getBtnpetkills() {
        return btnpetkills;
    }

    public void setBtnpetkills(PetPanelBtn1 btnpetkills) {
        this.btnpetkills = btnpetkills;
    }

    public PetPanelBtn1 getBtnpetarticles() {
        return btnpetarticles;
    }

    public void setBtnpetarticles(PetPanelBtn1 btnpetarticles) {
        this.btnpetarticles = btnpetarticles;
    }

    public PetPanelBtn1 getBtnsmeltmonster() {
        return btnsmeltmonster;
    }

    public void setBtnsmeltmonster(PetPanelBtn1 btnsmeltmonster) {
        this.btnsmeltmonster = btnsmeltmonster;
    }

    public PetPanelBtn1 getBtnrelease() {
        return btnrelease;
    }

    public void setBtnrelease(PetPanelBtn1 btnrelease) {
        this.btnrelease = btnrelease;
    }

    public PetPanelBtn1 getBtnsummon() {
        return btnsummon;
    }

    public void setBtnsummon(PetPanelBtn1 btnsummon) {
        this.btnsummon = btnsummon;
    }

    public static NeidanBtn[] getLabNedan() {
        return labNedan;
    }

    public static void setLabNedan(NeidanBtn[] labNedan) {
        TestPetJpanel1.labNedan = labNedan;
    }

    public static JLabel getLabclose() {
        return labclose;
    }

    public static void setLabclose(JLabel labclose) {
        TestPetJpanel1.labclose = labclose;
    }

    public static JLabel getLabCP() {
        return labCP;
    }

    public static void setLabCP(JLabel labCP) {
        TestPetJpanel1.labCP = labCP;
    }

    public static JLabel getLabconcentrate() {
        return labconcentrate;
    }

    public static void setLabconcentrate(JLabel labconcentrate) {
        TestPetJpanel1.labconcentrate = labconcentrate;
    }

    public PetPanelBtn1 getBtnwar() {
        return btnwar;
    }

    public void setBtnwar(PetPanelBtn1 btnwar) {
        this.btnwar = btnwar;
    }

    public PetPanelBtn1 getLingxi() {
        return lingxi;
    }

    public void setLingxi(PetPanelBtn1 lingxi) {
        this.lingxi = lingxi;
    }


    public PetPanelBtn1 getBtnRolequality() {
        return btnRolequality;
    }

    public void setBtnRolequality(PetPanelBtn1 btnRolequality) {
        this.btnRolequality = btnRolequality;
    }

    public GoodAndPetLockBtn getBtnlock() {
        return btnlock;
    }

    public void setBtnlock(GoodAndPetLockBtn btnlock) {
        this.btnlock = btnlock;
    }

    public GoodAndPetLockBtn getBtnunlock() {
        return btnunlock;
    }

    public void setBtnunlock(GoodAndPetLockBtn btnunlock) {
        this.btnunlock = btnunlock;
    }

    public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public static NewPart getPart() {
        return part;
    }

    public static void setPart(NewPart part) {
        TestPetJpanel1.part = part;
    }

    public static TestPetJpanel1 getTestPetJpanel1() {
        return testPetJpanel1;
    }

    public static void setTestPetJpanel1(TestPetJpanel1 testPetJpanel1) {
        TestPetJpanel1.testPetJpanel1 = testPetJpanel1;
    }

    public static int getWarNum() {
        return warNum;
    }

    public static void setWarNum(int warNum) {
        TestPetJpanel1.warNum = warNum;
    }

    public JLabel getChangeImg() {
        if (this.changeImg == null) {
            this.changeImg = new JLabel();
            this.changeImg.setOpaque(false);
            this.changeImg.setBounds(194, 66, 158, 218);
        }

        return this.changeImg;
    }

    public void setChangeImg(JLabel changeImg) {
        this.changeImg = changeImg;
    }


    public static JLabel getPetsum() {
        return TestPetJpanel1.petsum;
    }

    public static void setPetsum(final JLabel petsum) {
        TestPetJpanel1.petsum = petsum;
    }
}
